class Solution {
    public int findMinArrowShots(int[][] points) {
        if(points.length == 0) return 0;
        Arrays.sort(points,new Comparator<int[]>(){
            public int compare(int[] point1,int[] point2) {
                return point1[0] < point2[0] ? -1:1;
                //使用return point1[0] - point2[0];
                //[[-2147483646,-2147483645],[2147483646,2147483647]]报错
            }
        });
        int start = points[0][0],end = points[0][1];
        int count = 1;
        for(int i=1;i<points.length;++i){
            if(points[i][0]<=end){
                start = Math.max(points[i][0],start);
                end = Math.min(points[i][1],end);
            }else{
                count++;
                start = points[i][0];
                end = points[i][1];
            }
        }
        return count;
    }
}